public class Particle {
  //a reference to the engine
  protected ParticleEngine engine;
  //a position
  public float x;
  public float y;
  // a gravity
  protected float gravityX;
  protected float gravityY;
  // damping to simulate friction
  protected float damping;
  // color
  protected color col;
  protected color baseCol;
  protected color enlCol;
  protected color textCol;
  //size
  protected float size;
  
  //flag to indicate the particle is being dragged
  public boolean clicked;
  public boolean enlighted;
  public boolean linked;
  public String label; 
  public int g;
  
  //constructor, set initial variables
  public Particle(String label, int gender, float x, float y) {
    engine = null;
    this.label = label;
   this.g=g; 
    this.x = x;
    this.y = y;
    baseCol = color(160, 0, 240);
    if(gender==0){
      enlCol = color(140, 240, 144);
    }
    if(gender==1){
      enlCol = color(220, 240,168);
    }
    if(gender==2){
      enlCol = color(100, 240, 96);
    }
    size = 10;
    clicked = false;
    enlighted = false;
    linked=false;
    
  }
  
  public void setEngine(ParticleEngine engine) {
    this.engine = engine;
  }
  
  //a method to set the particles position and velocity
  public void setPos(float x, float y, float velocityX, float velocityY) {
    this.x = x;
    this.y = y;
  }
  
  //a method to update the particle (should be called avery frame
  public void update() {
    /*if(clicked || linked){
      enlighted=true;
      println(label+"en"+enlighted);
    }
    else enlighted=false; 
    
    return;*/
  }
   
  
  public void draw() {
    //draw the particle
    
    if(clicked){ 
      col = enlCol;
      fill(col);
      size=50;
      stroke(255);
      //enlighted=true;
    }else if(enlighted){
      noStroke();
      col = enlCol;
      fill(col);
      size=40;
    }
    
    // use alpha to fade away when life gets low
    ellipse(x, y, size, size);
    if(enlighted || clicked){
      fill(255);
      text(label, x-textWidth(label)*0.5, y+size/2);
    }
  }
  
  
}


  

